<!DOCTYPE html>
<html>
<head>
	<title>1-5</title>
	<style type="text/css">
		#div1 {
			width: 100px;
			height: 100px;
			background: red;
		}
	</style>
</head>
<body>

	<div id="div1"></div>
	<script type="text/javascript">
	function getStyle(obj, attr){
		if(obj.currentStyle){
			return obj.currentStyle[attr];
		}else{
			return getComputedStyle(obj, false)[attr];
		}
	}

	window.onload = function(){
		var oDiv1 = document.getElementById("div1");
		alert(getStyle(oDiv1, 'width'))
	}
	</script>

</body>
</html>